﻿package com.reyco1.util
{
	/*
	class
	*/
	public class MathUtil
	{
		/*
		Generate a random number in range
		*/
		
		/**
		 * Generates a random number within the provided range
		 * @param $maxInt : highest number
		 * @param $minInt : lowest number
		 * @return  : Number
		 * 
		 */		
		public static function random($maxInt:Number, $minInt:Number = 0):Number
		{
			var intRandom:Number = Math.floor(Math.random() * $maxInt - $minInt) + $minInt;
			return intRandom;
		}
		
		/*
		calculate percentage
		*/
		
		/**
		 * Calculates percentage
		 * @param $partial : partial number
		 * @param $total : total number
		 * @return : percentage
		 * 
		 */		
		public static  function percentage($partial:Number, $total:Number):Number
		{
			return Math.round($partial / $total * 100);
		}
	}
}